/*
 * @Author: kongxueyang kongxueyang@datatang.com
 * @Date: 2023-09-21 10:12:52
 * @LastEditors: kongxueyang kongxueyang@datatang.com
 * @LastEditTime: 2023-09-27 10:10:12
 * @FilePath: \meek\webpack.config.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
/* eslint-disable no-var */
var path = require('path')
var webpack = require('webpack')
var Clean = require('clean-webpack-plugin')

var webpackConfig = require('./webpack-base-config')
webpackConfig.entry = path.resolve(__dirname, 'src/main.js')

if (process.env.npm_lifecycle_event === 'release') {
  webpackConfig.plugins.push(new webpack.optimize.UglifyJsPlugin({
    compress: {
      warnings: false,
      pure_funcs: ['console.log']
    },
    output: {comments: false}
  }))
  
  webpackConfig.devtool = null
} else {
  webpackConfig.plugins.push(new Clean(['dist'], {verbose: false}))
}

webpackConfig.output = {
  path: path.resolve(__dirname, 'dist'),
  // path: path.resolve(__dirname, '../library-monorepo/packages/template-core/node_modules/meek/dist'),
  // path: path.resolve(__dirname, '../template_crowd3/node_modules/meek/dist'),
  publicPath: '<%=baseUrl%>/',
  filename: 'meek.min.js',
  library: 'Datatang',
  libraryTarget: 'umd'
}

module.exports = webpackConfig
